//
// Created by jinbang.li on 2023/9/9.
//

#include "IOpPlayProxy.h"
#include "OpPlayerBuilder.h"

void IOpPlayProxy::Init(void *vm) {
    mux.lock();
    if (vm){
        OpPlayerBuilder::initHard(vm);
    }
    if (!player){
        player = OpPlayerBuilder::get()->BuilderPlayer();
    }
    mux.unlock();
}

bool IOpPlayProxy::open(const char *path) {
    bool  re = false;
    mux.lock();
    if (player){
        re = player->open(path);
    }
    mux.unlock();
    return re;
}
bool IOpPlayProxy::start() {
    bool re = false;
    mux.lock();
    if (player){
        re = player->start();
    }
    mux.unlock();
    return re;
}
void IOpPlayProxy::InitView(void *win) {
    mux.lock();
    if (player){
        player->InitView(win);
    }
    mux.unlock();
}